package org.apache.hadoop.mapred;

import java.io.IOException;
import java.net.InetSocketAddress;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.MRConfig;
import org.apache.hadoop.mapreduce.protocol.ClientProtocol;
import org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider;
/**
 * A {@link ClientProtocolProvider} for {@link RRDLocalJobRunner}
 * @author IEUser
 *
 */
public class RRDLocalClientProtocolProvider extends ClientProtocolProvider {

	  @Override
	  public ClientProtocol create(Configuration conf) throws IOException {
	    String framework = conf.get(MRConfig.FRAMEWORK_NAME, "rrd-local");
	    if (!"rrd-local".equals(framework)) {
	      return null;
	    }
	    //conf.setInt(JobContext.NUM_MAPS, 1);
	    return new RRDLocalJobRunner(conf);
	  }

	  @Override
	  public ClientProtocol create(InetSocketAddress addr, Configuration conf) {
	    return null; // LocalJobRunner doesn't use a socket
	  }

	  @Override
	  public void close(ClientProtocol clientProtocol) {
	    // no clean up required
	  }

}
